﻿//
// USBCConfiguration.cs
//
// Authors:
//    Claus Jørgensen <10229@iha.dk>
//    Jens Bloch Christensen <09584@iha.dk>
//    Jonas Daugaard Møller <08814@iha.dk>
//
using System.Runtime.InteropServices;

namespace RSD.Robot
{
    /// <summary>
    /// Managed configuration data structure.
    /// </summary>
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    public struct USBCConfiguration
    {
        /// <summary>
        /// Initialization mode.
        /// </summary>
        public short Mode;

        /// <summary>
        /// Axes Ids.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = USBC.TotalAxes)]
        public short[] Type;

        /// <summary>
        /// USBC driver version.
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr, SizeConst = 24)]
        public string SoftwareVersion;

        /// <summary>
        /// Type of the connected robot.
        /// </summary>
        public short RobotType;

        /// <summary>
        /// Axes values.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
        public short[] Axes;

        /// <summary>
        /// Point values.
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
        public short[] Points;

        /// <summary>
        /// Total amount of robot axes.
        /// </summary>
        public short AxesCount;

        /// <summary>
        /// Gripper Id. 
        /// </summary>
        public short Gripper;

        /// <summary>
        /// Digital input signal count.
        /// </summary>
        public short DigitalInputCount;

        /// <summary>
        /// Digital output signal count.
        /// </summary>
        public short DigitalOutputCount;

        /// <summary>
        /// Analog input signal count.
        /// </summary>
        public short AnalogInputCount;

        /// <summary>
        /// Analog output signal count.
        /// </summary>
        public short AnalogOutputCount;

        /// <summary>
        /// Gripper range in milimeters.
        /// </summary>
        public short GripperRange;

        /// <summary>
        /// USB DeviceId 1.
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr, SizeConst = 16)]
        public string DeviceID1;

        /// <summary>
        /// USB DeviceId 2.
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr, SizeConst = 16)]
        public string DeviceID2;
    }
}
